package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.BizPurchaseOrderDetailMapper;
import com.ruoyi.system.domain.BizPurchaseOrderDetail;
import com.ruoyi.system.service.IBizPurchaseOrderDetailService;
import com.ruoyi.common.core.text.Convert;

/**
 * 采购订单明细Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-18
 */
@Service
public class BizPurchaseOrderDetailServiceImpl implements IBizPurchaseOrderDetailService 
{
    @Autowired
    private BizPurchaseOrderDetailMapper bizPurchaseOrderDetailMapper;

    /**
     * 查询采购订单明细
     * 
     * @param detailId 采购订单明细主键
     * @return 采购订单明细
     */
    @Override
    public BizPurchaseOrderDetail selectBizPurchaseOrderDetailByDetailId(Long detailId)
    {
        return bizPurchaseOrderDetailMapper.selectBizPurchaseOrderDetailByDetailId(detailId);
    }

    /**
     * 查询采购订单明细列表
     * 
     * @param bizPurchaseOrderDetail 采购订单明细
     * @return 采购订单明细
     */
    @Override
    public List<BizPurchaseOrderDetail> selectBizPurchaseOrderDetailList(BizPurchaseOrderDetail bizPurchaseOrderDetail)
    {
        return bizPurchaseOrderDetailMapper.selectBizPurchaseOrderDetailList(bizPurchaseOrderDetail);
    }

    /**
     * 新增采购订单明细
     * 
     * @param bizPurchaseOrderDetail 采购订单明细
     * @return 结果
     */
    @Override
    public int insertBizPurchaseOrderDetail(BizPurchaseOrderDetail bizPurchaseOrderDetail)
    {
        bizPurchaseOrderDetail.setCreateTime(DateUtils.getNowDate());
        return bizPurchaseOrderDetailMapper.insertBizPurchaseOrderDetail(bizPurchaseOrderDetail);
    }

    /**
     * 修改采购订单明细
     * 
     * @param bizPurchaseOrderDetail 采购订单明细
     * @return 结果
     */
    @Override
    public int updateBizPurchaseOrderDetail(BizPurchaseOrderDetail bizPurchaseOrderDetail)
    {
        bizPurchaseOrderDetail.setUpdateTime(DateUtils.getNowDate());
        return bizPurchaseOrderDetailMapper.updateBizPurchaseOrderDetail(bizPurchaseOrderDetail);
    }

    /**
     * 批量删除采购订单明细
     * 
     * @param detailIds 需要删除的采购订单明细主键
     * @return 结果
     */
    @Override
    public int deleteBizPurchaseOrderDetailByDetailIds(String detailIds)
    {
        return bizPurchaseOrderDetailMapper.deleteBizPurchaseOrderDetailByDetailIds(Convert.toStrArray(detailIds));
    }

    /**
     * 删除采购订单明细信息
     * 
     * @param detailId 采购订单明细主键
     * @return 结果
     */
    @Override
    public int deleteBizPurchaseOrderDetailByDetailId(Long detailId)
    {
        return bizPurchaseOrderDetailMapper.deleteBizPurchaseOrderDetailByDetailId(detailId);
    }
}
